/**
 * CalendarList
 *
 * Some navigation extra's
 *
 */

var CalendarList = function( ref, action )	{

	Object.extend( obj = $$( '.CalendarList' ).pop(), CalendarList.proto );
	Object.extend( obj, CalendarList[ "proto_" + action ]);
	obj.ref = ref;
		
	return obj;
}


CalendarList.proto = {
	
	current		: 0
}

CalendarList.proto_alldates = {
	
	init		: function() {
	
		this.childs = obj.down( ".days" ).childElements().each( this.sugar, this );
		this.uls = obj.down().childElements();
		
		this.uls.shift();
		
	},
	
	sugar		: function( el, n ) {
		
		el.observe( "click", this.flip.bind( this, n ));
		el.n = n;
		
	},
	
	flip		: function( n ) {
		
		this.select( ".active" ).each( function( el ){ el.removeClassName( "active" ) });
		this.childs[ n ].addClassName( "active" );
		
		this.uls[ n ].down().addClassName( "active" );
	}
}